import multiprocessing
import time
import os
# Process类执行任务并给任务传参数有两种方式:

# args 表示以元组的方式给执行任务传参
# kwargs 表示以字典方式给执行任务传参
def dance(count):
   # 获取当前进程的编号
  print('dance',os.getpid())
  # 获取当前进程
  print("dance",multiprocessing.current_process())
  for i in range(count):
    print("跳舞中...")
    time.sleep(0.2)
def sing(count):
   # 获取当前进程的编号
  print('sing',os.getpid())
  # 获取当前进程
  print("sing",multiprocessing.current_process())
  for i in range(count):
    print("唱歌中...")
    time.sleep(0.2)
if __name__ == "__main__":
  # 获取当前进程的编号
  print('main',os.getpid())
  # 获取当前进程
  print("main",multiprocessing.current_process())
  danceProcess=multiprocessing.Process(target=dance,args=(5,))
  singProcess=multiprocessing.Process(target=sing,kwargs={"count":10})

  danceProcess.start()
  singProcess.start()


